package com.cql.controller;

import com.cql.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@CrossOrigin
@RequestMapping("/attachmeController")
public class AttachmeController {

    @Autowired
    AttachmeFeignClient attachmeFeignClient;

    @PostMapping(value = "/multifileUpload", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public String upload(@RequestPart("file")MultipartFile file, @RequestParam("name") String name) {
        System.out.println(file.getOriginalFilename() + "~~~" + name);

        return attachmeFeignClient.upload(file, name);
    }
}
